package spring.cloud.tasks.api.utils;

import org.apache.curator.framework.CuratorFramework;

public final class ThreadLocalCuratorClient {

    private static final ThreadLocal<CuratorFramework> curatorFrameworkThreadLocal = new ThreadLocal<>();

    private ThreadLocalCuratorClient() {
    }

    public static CuratorFramework getCuratorFrameworkThreadLocal() {
        return curatorFrameworkThreadLocal.get();
    }

    public static void setCuratorFrameworkThreadLocal(final CuratorFramework curatorFramework) {
        curatorFrameworkThreadLocal.set(curatorFramework);
    }

    public static void clear() {
        curatorFrameworkThreadLocal.remove();
    }
}
